package com.eduhzy.ttw.teacher.di.module;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.eduhzy.ttw.commonsdk.entity.MineClassData;
import com.eduhzy.ttw.commonsdk.holder.AutoBaseViewHolder;
import com.eduhzy.ttw.teacher.R;
import com.eduhzy.ttw.teacher.mvp.contract.MineClassContract;
import com.eduhzy.ttw.teacher.mvp.model.MineClassModel;
import com.jess.arms.di.scope.ActivityScope;

import java.util.ArrayList;
import java.util.List;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;


@Module
public abstract class MineClassModule {

    @Binds
    abstract MineClassContract.Model bindMineClassModel(MineClassModel model);

    @ActivityScope
    @Provides
    static List<MineClassData> provideList() {
        return new ArrayList<>();
    }

    @ActivityScope
    @Provides
    static BaseQuickAdapter<MineClassData, AutoBaseViewHolder> provideActivityAdapter(List<MineClassData> list) {
        return new BaseQuickAdapter<MineClassData, AutoBaseViewHolder>(R.layout.rv_item_mine_class, list) {
            @Override
            protected void convert(AutoBaseViewHolder helper, MineClassData item) {
                helper.setText(R.id.tv_class_name,item.getBjmc());
                helper.setText(R.id.tv_class_no,item.getBaseNo());
//                Glide.with(helper.itemView.getContext())
//                        .load(item.get)
//                        .apply(RequestOptions.placeholderOf(R.drawable.img_touxiang).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL))
//                        .into(ivAvatar);

            }
        };
    }

    @ActivityScope
    @Provides
    static RecyclerView.LayoutManager provideLayoutManger(MineClassContract.View view) {
        return new LinearLayoutManager(view.getActivity());
    }


}